package com.bdcom.model;

import java.awt.Point;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public abstract class AbstractBarrier implements IBarrier {
	
	//记录障碍物轨迹的点
	private List<Point> points=new ArrayList<>();
	//描述障碍物属性的	
	private BarrierType barrierType;
	
	//private transient GeneralPath generalPath;
	
	//sub getter and setter
	public List<Point> getPoints() {
		return points;
	}

	public void setPoints(List<Point> points) {
		this.points = points;
	}

	public BarrierType getBarrierType() {
		return barrierType;
	}

	public void setBarrierType(BarrierType barrierType) {
		this.barrierType = barrierType;
	}

//	public GeneralPath getGeneralPath() {
//		return generalPath;
//	}
//
//	public void setGeneralPath(GeneralPath generalPath) {
//		this.generalPath = generalPath;
//	}
	//end sub getter and setter
	
	public void drag(double deltax, double deltay) {
		// TODO Auto-generated method stub
		Iterator<Point> itPoint=getPoints().iterator();
		
		Point point;
		
		while(itPoint.hasNext()){
			
			point=itPoint.next();
			
			point.translate((int)deltax, (int)deltay);
		}
		
	}

	public void drag(double deltax, double deltay, int index) {
		// TODO Auto-generated method stub
		getPoints().get(index).translate((int)deltax, (int)deltay);
	}

	public void removePoint(int selectedPointIndex) {
		// TODO Auto-generated method stub
		points.remove(selectedPointIndex);
	}
	
	
}
